//
//  HWsetUpCell.m
//  HWanGame
//
//  Created by 陈道斌 on 2019/10/28.
//  Copyright © 2019 Chendaobin. All rights reserved.
//

#import "HWsetUpCell.h"

@interface HWsetUpCell()
@property(strong,nonatomic) UILabel *leftLabel;
@property(strong,nonatomic) UILabel *rightLabel;
@property(strong,nonatomic) UISwitch *rightSwitch;
@property(strong,nonatomic) UIView *fenxianView;

@end

@implementation HWsetUpCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self addView];
        
    }
    
    return  self;
    
}

// 添加Uiview
- (void)addView {
    
    self.leftLabel = [[UILabel alloc]initWithFrame:CGRectMake(15, 0, 200, 40)];
    self.leftLabel.text  = @"消息推送";
    self.leftLabel.font = [UIFont systemFontOfSize:13];
    self.leftLabel.textColor = RGB(51, 51, 51);
    [self.contentView addSubview:self.leftLabel];
    self.rightSwitch = [[UISwitch alloc]initWithFrame:CGRectMake(kScreenW-51-15, 4,51, 31)];
    [self.contentView addSubview:self.rightSwitch];

    
    self.rightLabel = [[UILabel alloc]initWithFrame:CGRectMake(kScreenW-200-15, 0, 200, 40)];
    self.rightLabel.text  = @"V2.0";
    self.rightLabel.font = [UIFont systemFontOfSize:12];
    self.rightLabel.textColor = RGB(153, 153, 153);
    self.rightLabel.textAlignment =  NSTextAlignmentRight;
    [self.contentView addSubview:self.rightLabel];
    
    self.fenxianView = [[UIView alloc]initWithFrame:CGRectMake(0, 39, kScreenW, 1)];
    self.fenxianView.backgroundColor = xiatiaoyanSehui;
    
    [self.contentView addSubview:self.fenxianView];
    
    
    
    
    
    
}

-(void)setModel:(HWSetupModel *)model {
    
    _model = model;
    
    
    //    @property(strong,nonatomic) NSString *titltStr;
    //    @property(strong,nonatomic) NSString *rightStr;
    //    @property(assign,nonatomic) BOOL kaiguan; // 开关
    //    @property(strong,nonatomic) NSString *shifouxianshiKaiguan; // 1.代表显示开关 2. 代表不显示开关
        
    self.leftLabel.text = model.titltStr;
    self.rightSwitch.on = NO;
    if ([model.shifouxianshiKaiguan isEqualToString:@"1"]) {
        self.rightSwitch.hidden = NO;
        self.rightLabel.hidden = YES;
        
    } else {
        
        self.rightSwitch.hidden = YES;
        self.rightLabel.hidden = NO;
        self.rightLabel.text = model.rightStr;
        
    
    }
    
  
    
    
    
}




@end
